
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/physics/quantum/spin.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:27:47 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Spin &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
    <script src="../../../_static/jquery.js"></script>
    <script src="../../../_static/underscore.js"></script>
    <script src="../../../_static/doctools.js"></script>
    <script src="../../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../../_static/sympy-notailtext-favicon.ico"/>
    <link href="spin.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" />
    <link rel="next" title="State" href="state.html" />
    <link rel="prev" title="Represent" href="represent.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="state.html" title="State"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="represent.html" title="Represent"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../index.html" >Physics</a> &#187;</li>
          <li class="nav-item nav-item-3"><a href="index.html" accesskey="U">Quantum Mechanics</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Spin</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-sympy.physics.quantum.spin">
<span id="spin"></span><h1>Spin<a class="headerlink" href="#module-sympy.physics.quantum.spin" title="Permalink to this headline">¶</a></h1>
<p>Quantum mechanical angular momemtum.</p>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.J2Op">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">J2Op</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L348-L418"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.J2Op" title="Permalink to this definition">¶</a></dt>
<dd><p>The J^2 operator.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JxBra">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JxBra</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1099-L1117"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JxBra" title="Permalink to this definition">¶</a></dt>
<dd><p>Eigenbra of Jx.</p>
<p>See JzKet for the usage of spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKet" title="sympy.physics.quantum.spin.JzKet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKet</span></code></a></dt><dd><p>Usage of spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JxBraCoupled">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JxBraCoupled</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jn</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">jcoupling</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1548-L1566"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JxBraCoupled" title="Permalink to this definition">¶</a></dt>
<dd><p>Coupled eigenbra of Jx.</p>
<p>See JzKetCoupled for the usage of coupled spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKetCoupled" title="sympy.physics.quantum.spin.JzKetCoupled"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKetCoupled</span></code></a></dt><dd><p>Usage of coupled spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JxKet">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JxKet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1066-L1096"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JxKet" title="Permalink to this definition">¶</a></dt>
<dd><p>Eigenket of Jx.</p>
<p>See JzKet for the usage of spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKet" title="sympy.physics.quantum.spin.JzKet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKet</span></code></a></dt><dd><p>Usage of spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JxKetCoupled">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JxKetCoupled</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jn</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">jcoupling</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1515-L1545"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JxKetCoupled" title="Permalink to this definition">¶</a></dt>
<dd><p>Coupled eigenket of Jx.</p>
<p>See JzKetCoupled for the usage of coupled spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKetCoupled" title="sympy.physics.quantum.spin.JzKetCoupled"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKetCoupled</span></code></a></dt><dd><p>Usage of coupled spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JyBra">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JyBra</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1153-L1171"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JyBra" title="Permalink to this definition">¶</a></dt>
<dd><p>Eigenbra of Jy.</p>
<p>See JzKet for the usage of spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKet" title="sympy.physics.quantum.spin.JzKet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKet</span></code></a></dt><dd><p>Usage of spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JyBraCoupled">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JyBraCoupled</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jn</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">jcoupling</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1602-L1620"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JyBraCoupled" title="Permalink to this definition">¶</a></dt>
<dd><p>Coupled eigenbra of Jy.</p>
<p>See JzKetCoupled for the usage of coupled spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKetCoupled" title="sympy.physics.quantum.spin.JzKetCoupled"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKetCoupled</span></code></a></dt><dd><p>Usage of coupled spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JyKet">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JyKet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1120-L1150"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JyKet" title="Permalink to this definition">¶</a></dt>
<dd><p>Eigenket of Jy.</p>
<p>See JzKet for the usage of spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKet" title="sympy.physics.quantum.spin.JzKet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKet</span></code></a></dt><dd><p>Usage of spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JyKetCoupled">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JyKetCoupled</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jn</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">jcoupling</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1569-L1599"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JyKetCoupled" title="Permalink to this definition">¶</a></dt>
<dd><p>Coupled eigenket of Jy.</p>
<p>See JzKetCoupled for the usage of coupled spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKetCoupled" title="sympy.physics.quantum.spin.JzKetCoupled"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKetCoupled</span></code></a></dt><dd><p>Usage of coupled spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JzBra">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JzBra</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1306-L1324"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JzBra" title="Permalink to this definition">¶</a></dt>
<dd><p>Eigenbra of Jz.</p>
<p>See the JzKet for the usage of spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKet" title="sympy.physics.quantum.spin.JzKet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKet</span></code></a></dt><dd><p>Usage of spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JzBraCoupled">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JzBraCoupled</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jn</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">jcoupling</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1761-L1779"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JzBraCoupled" title="Permalink to this definition">¶</a></dt>
<dd><p>Coupled eigenbra of Jz.</p>
<p>See the JzKetCoupled for the usage of coupled spin eigenstates.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKetCoupled" title="sympy.physics.quantum.spin.JzKetCoupled"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKetCoupled</span></code></a></dt><dd><p>Usage of coupled spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JzKet">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JzKet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1174-L1303"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JzKet" title="Permalink to this definition">¶</a></dt>
<dd><p>Eigenket of Jz.</p>
<p>Spin state which is an eigenstate of the Jz operator. Uncoupled states,
that is states representing the interaction of multiple separate spin
states, are defined as a tensor product of states.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>j</strong> : Number, Symbol</p>
<blockquote>
<div><p>Total spin angular momentum</p>
</div></blockquote>
<p><strong>m</strong> : Number, Symbol</p>
<blockquote>
<div><p>Eigenvalue of the Jz spin operator</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p><em>Normal States:</em></p>
<p>Defining simple spin states, both numerical and symbolic:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">JzKet</span><span class="p">,</span> <span class="n">JxKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="go">|1,0&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j</span><span class="p">,</span> <span class="n">m</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;j m&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">JzKet</span><span class="p">(</span><span class="n">j</span><span class="p">,</span> <span class="n">m</span><span class="p">)</span>
<span class="go">|j,m&gt;</span>
</pre></div>
</div>
<p>Rewriting the JzKet in terms of eigenkets of the Jx operator:
Note: that the resulting eigenstates are JxKet’s</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">rewrite</span><span class="p">(</span><span class="s2">&quot;Jx&quot;</span><span class="p">)</span>
<span class="go">|1,-1&gt;/2 - sqrt(2)*|1,0&gt;/2 + |1,1&gt;/2</span>
</pre></div>
</div>
<p>Get the vector representation of a state in terms of the basis elements
of the Jx operator:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.represent</span> <span class="kn">import</span> <span class="n">represent</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">Jx</span><span class="p">,</span> <span class="n">Jz</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">represent</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span> <span class="n">basis</span><span class="o">=</span><span class="n">Jx</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[      1/2],</span>
<span class="go">[sqrt(2)/2],</span>
<span class="go">[      1/2]])</span>
</pre></div>
</div>
<p>Apply innerproducts between states:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.innerproduct</span> <span class="kn">import</span> <span class="n">InnerProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">JxBra</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">InnerProduct</span><span class="p">(</span><span class="n">JxBra</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span>
<span class="go">&lt;1,1|1,1&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">i</span><span class="o">.</span><span class="n">doit</span><span class="p">()</span>
<span class="go">1/2</span>
</pre></div>
</div>
<p><em>Uncoupled States:</em></p>
<p>Define an uncoupled state as a TensorProduct between two Jz eigenkets:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.tensorproduct</span> <span class="kn">import</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j1</span><span class="p">,</span><span class="n">m1</span><span class="p">,</span><span class="n">j2</span><span class="p">,</span><span class="n">m2</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;j1 m1 j2 m2&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="go">|1,0&gt;x|1,1&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="n">j1</span><span class="p">,</span><span class="n">m1</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="n">j2</span><span class="p">,</span><span class="n">m2</span><span class="p">))</span>
<span class="go">|j1,m1&gt;x|j2,m2&gt;</span>
</pre></div>
</div>
<p>A TensorProduct can be rewritten, in which case the eigenstates that make
up the tensor product is rewritten to the new basis:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span><span class="n">JxKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">rewrite</span><span class="p">(</span><span class="s1">&#39;Jz&#39;</span><span class="p">)</span>
<span class="go">|1,1&gt;x|1,-1&gt;/2 + sqrt(2)*|1,1&gt;x|1,0&gt;/2 + |1,1&gt;x|1,1&gt;/2</span>
</pre></div>
</div>
<p>The represent method for TensorProduct’s gives the vector representation of
the state. Note that the state in the product basis is the equivalent of the
tensor product of the vector representation of the component eigenstates:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">represent</span><span class="p">(</span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)))</span>
<span class="go">Matrix([</span>
<span class="go">[0],</span>
<span class="go">[0],</span>
<span class="go">[0],</span>
<span class="go">[1],</span>
<span class="go">[0],</span>
<span class="go">[0],</span>
<span class="go">[0],</span>
<span class="go">[0],</span>
<span class="go">[0]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">represent</span><span class="p">(</span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span><span class="n">JxKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)),</span> <span class="n">basis</span><span class="o">=</span><span class="n">Jz</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[      1/2],</span>
<span class="go">[sqrt(2)/2],</span>
<span class="go">[      1/2],</span>
<span class="go">[        0],</span>
<span class="go">[        0],</span>
<span class="go">[        0],</span>
<span class="go">[        0],</span>
<span class="go">[        0],</span>
<span class="go">[        0]])</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKetCoupled" title="sympy.physics.quantum.spin.JzKetCoupled"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKetCoupled</span></code></a></dt><dd><p>Coupled eigenstates</p>
</dd>
<dt><a class="reference internal" href="tensorproduct.html#sympy.physics.quantum.tensorproduct.TensorProduct" title="sympy.physics.quantum.tensorproduct.TensorProduct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.physics.quantum.tensorproduct.TensorProduct</span></code></a></dt><dd><p>Used to specify uncoupled states</p>
</dd>
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.uncouple" title="sympy.physics.quantum.spin.uncouple"><code class="xref py py-obj docutils literal notranslate"><span class="pre">uncouple</span></code></a></dt><dd><p>Uncouples states given coupling parameters</p>
</dd>
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.couple" title="sympy.physics.quantum.spin.couple"><code class="xref py py-obj docutils literal notranslate"><span class="pre">couple</span></code></a></dt><dd><p>Couples uncoupled states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JzKetCoupled">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JzKetCoupled</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jn</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">jcoupling</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1623-L1758"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JzKetCoupled" title="Permalink to this definition">¶</a></dt>
<dd><p>Coupled eigenket of Jz</p>
<p>Spin state that is an eigenket of Jz which represents the coupling of
separate spin spaces.</p>
<p>The arguments for creating instances of JzKetCoupled are <code class="docutils literal notranslate"><span class="pre">j</span></code>, <code class="docutils literal notranslate"><span class="pre">m</span></code>,
<code class="docutils literal notranslate"><span class="pre">jn</span></code> and an optional <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> argument. The <code class="docutils literal notranslate"><span class="pre">j</span></code> and <code class="docutils literal notranslate"><span class="pre">m</span></code> options
are the total angular momentum quantum numbers, as used for normal states
(e.g. JzKet).</p>
<p>The other required parameter in <code class="docutils literal notranslate"><span class="pre">jn</span></code>, which is a tuple defining the <span class="math notranslate nohighlight">\(j_n\)</span>
angular momentum quantum numbers of the product spaces. So for example, if
a state represented the coupling of the product basis state
<span class="math notranslate nohighlight">\(\left|j_1,m_1\right\rangle\times\left|j_2,m_2\right\rangle\)</span>, the <code class="docutils literal notranslate"><span class="pre">jn</span></code>
for this state would be <code class="docutils literal notranslate"><span class="pre">(j1,j2)</span></code>.</p>
<p>The final option is <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code>, which is used to define how the spaces
specified by <code class="docutils literal notranslate"><span class="pre">jn</span></code> are coupled, which includes both the order these spaces
are coupled together and the quantum numbers that arise from these
couplings. The <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> parameter itself is a list of lists, such that
each of the sublists defines a single coupling between the spin spaces. If
there are N coupled angular momentum spaces, that is <code class="docutils literal notranslate"><span class="pre">jn</span></code> has N elements,
then there must be N-1 sublists. Each of these sublists making up the
<code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> parameter have length 3. The first two elements are the
indices of the product spaces that are considered to be coupled together.
For example, if we want to couple <span class="math notranslate nohighlight">\(j_1\)</span> and <span class="math notranslate nohighlight">\(j_4\)</span>, the indices would be 1
and 4. If a state has already been coupled, it is referenced by the
smallest index that is coupled, so if <span class="math notranslate nohighlight">\(j_2\)</span> and <span class="math notranslate nohighlight">\(j_4\)</span> has already been
coupled to some <span class="math notranslate nohighlight">\(j_{24}\)</span>, then this value can be coupled by referencing it
with index 2. The final element of the sublist is the quantum number of the
coupled state. So putting everything together, into a valid sublist for
<code class="docutils literal notranslate"><span class="pre">jcoupling</span></code>, if <span class="math notranslate nohighlight">\(j_1\)</span> and <span class="math notranslate nohighlight">\(j_2\)</span> are coupled to an angular momentum space
with quantum number <span class="math notranslate nohighlight">\(j_{12}\)</span> with the value <code class="docutils literal notranslate"><span class="pre">j12</span></code>, the sublist would be
<code class="docutils literal notranslate"><span class="pre">(1,2,j12)</span></code>, N-1 of these sublists are used in the list for
<code class="docutils literal notranslate"><span class="pre">jcoupling</span></code>.</p>
<p>Note the <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> parameter is optional, if it is not specified, the
default coupling is taken. This default value is to coupled the spaces in
order and take the quantum number of the coupling to be the maximum value.
For example, if the spin spaces are <span class="math notranslate nohighlight">\(j_1\)</span>, <span class="math notranslate nohighlight">\(j_2\)</span>, <span class="math notranslate nohighlight">\(j_3\)</span>, <span class="math notranslate nohighlight">\(j_4\)</span>, then the
default coupling couples <span class="math notranslate nohighlight">\(j_1\)</span> and <span class="math notranslate nohighlight">\(j_2\)</span> to <span class="math notranslate nohighlight">\(j_{12}=j_1+j_2\)</span>, then,
<span class="math notranslate nohighlight">\(j_{12}\)</span> and <span class="math notranslate nohighlight">\(j_3\)</span> are coupled to <span class="math notranslate nohighlight">\(j_{123}=j_{12}+j_3\)</span>, and finally
<span class="math notranslate nohighlight">\(j_{123}\)</span> and <span class="math notranslate nohighlight">\(j_4\)</span> to <span class="math notranslate nohighlight">\(j=j_{123}+j_4\)</span>. The jcoupling value that would
correspond to this is:</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">((1,2,j1+j2),(1,3,j1+j2+j3))</span></code></p>
</div></blockquote>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>args</strong> : tuple</p>
<blockquote>
<div><p>The arguments that must be passed are <code class="docutils literal notranslate"><span class="pre">j</span></code>, <code class="docutils literal notranslate"><span class="pre">m</span></code>, <code class="docutils literal notranslate"><span class="pre">jn</span></code>, and
<code class="docutils literal notranslate"><span class="pre">jcoupling</span></code>. The <code class="docutils literal notranslate"><span class="pre">j</span></code> value is the total angular momentum. The <code class="docutils literal notranslate"><span class="pre">m</span></code>
value is the eigenvalue of the Jz spin operator. The <code class="docutils literal notranslate"><span class="pre">jn</span></code> list are
the j values of argular momentum spaces coupled together. The
<code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> parameter is an optional parameter defining how the spaces
are coupled together. See the above description for how these coupling
parameters are defined.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>Defining simple spin states, both numerical and symbolic:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">JzKetCoupled</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">|1,0,j1=1,j2=1&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="n">j1</span><span class="p">,</span> <span class="n">j2</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;j m j1 j2&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="n">j</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="p">(</span><span class="n">j1</span><span class="p">,</span> <span class="n">j2</span><span class="p">))</span>
<span class="go">|j,m,j1=j1,j2=j2&gt;</span>
</pre></div>
</div>
<p>Defining coupled spin states for more than 2 coupled spaces with various
coupling parameters:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">|2,1,j1=1,j2=1,j3=1,j(1,2)=2&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="p">)</span>
<span class="go">|2,1,j1=1,j2=1,j3=1,j(1,2)=2&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="p">)</span>
<span class="go">|2,1,j1=1,j2=1,j3=1,j(2,3)=1&gt;</span>
</pre></div>
</div>
<p>Rewriting the JzKetCoupled in terms of eigenkets of the Jx operator:
Note: that the resulting eigenstates are JxKetCoupled</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">rewrite</span><span class="p">(</span><span class="s2">&quot;Jx&quot;</span><span class="p">)</span>
<span class="go">|1,-1,j1=1,j2=1&gt;/2 - sqrt(2)*|1,0,j1=1,j2=1&gt;/2 + |1,1,j1=1,j2=1&gt;/2</span>
</pre></div>
</div>
<p>The rewrite method can be used to convert a coupled state to an uncoupled
state. This is done by passing coupled=False to the rewrite function:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">rewrite</span><span class="p">(</span><span class="s1">&#39;Jz&#39;</span><span class="p">,</span> <span class="n">coupled</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">-sqrt(2)*|1,-1&gt;x|1,1&gt;/2 + sqrt(2)*|1,1&gt;x|1,-1&gt;/2</span>
</pre></div>
</div>
<p>Get the vector representation of a state in terms of the basis elements
of the Jx operator:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.represent</span> <span class="kn">import</span> <span class="n">represent</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">Jx</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">S</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">represent</span><span class="p">(</span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,(</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">)),</span> <span class="n">basis</span><span class="o">=</span><span class="n">Jx</span><span class="p">)</span>
<span class="go">Matrix([</span>
<span class="go">[        0],</span>
<span class="go">[      1/2],</span>
<span class="go">[sqrt(2)/2],</span>
<span class="go">[      1/2]])</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.JzKet" title="sympy.physics.quantum.spin.JzKet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">JzKet</span></code></a></dt><dd><p>Normal spin eigenstates</p>
</dd>
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.uncouple" title="sympy.physics.quantum.spin.uncouple"><code class="xref py py-obj docutils literal notranslate"><span class="pre">uncouple</span></code></a></dt><dd><p>Uncoupling of coupling spin states</p>
</dd>
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.couple" title="sympy.physics.quantum.spin.couple"><code class="xref py py-obj docutils literal notranslate"><span class="pre">couple</span></code></a></dt><dd><p>Coupling of uncoupled spin states</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.JzOp">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">JzOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L316-L345"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.JzOp" title="Permalink to this definition">¶</a></dt>
<dd><p>The Jz operator.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.Rotation">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">Rotation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L421-L686"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.Rotation" title="Permalink to this definition">¶</a></dt>
<dd><p>Wigner D operator in terms of Euler angles.</p>
<p>Defines the rotation operator in terms of the Euler angles defined by
the z-y-z convention for a passive transformation. That is the coordinate
axes are rotated first about the z-axis, giving the new x’-y’-z’ axes. Then
this new coordinate system is rotated about the new y’-axis, giving new
x’’-y’’-z’’ axes. Then this new coordinate system is rotated about the
z’’-axis. Conventions follow those laid out in <a class="reference internal" href="#r638" id="id1"><span>[R638]</span></a>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>alpha</strong> : Number, Symbol</p>
<blockquote>
<div><p>First Euler Angle</p>
</div></blockquote>
<p><strong>beta</strong> : Number, Symbol</p>
<blockquote>
<div><p>Second Euler angle</p>
</div></blockquote>
<p><strong>gamma</strong> : Number, Symbol</p>
<blockquote>
<div><p>Third Euler angle</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>A simple example rotation operator:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">Rotation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Rotation</span><span class="p">(</span><span class="n">pi</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
<span class="go">R(pi,0,pi/2)</span>
</pre></div>
</div>
<p>With symbolic Euler angles and calculating the inverse rotation operator:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a b c&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Rotation</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">)</span>
<span class="go">R(a,b,c)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Rotation</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">)</span><span class="o">.</span><span class="n">inverse</span><span class="p">()</span>
<span class="go">R(-c,-b,-a)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.WignerD" title="sympy.physics.quantum.spin.WignerD"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WignerD</span></code></a></dt><dd><p>Symbolic Wigner-D function</p>
</dd>
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.Rotation.D" title="sympy.physics.quantum.spin.Rotation.D"><code class="xref py py-obj docutils literal notranslate"><span class="pre">D</span></code></a></dt><dd><p>Wigner-D function</p>
</dd>
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.Rotation.d" title="sympy.physics.quantum.spin.Rotation.d"><code class="xref py py-obj docutils literal notranslate"><span class="pre">d</span></code></a></dt><dd><p>Wigner small-d function</p>
</dd>
</dl>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r638"><span class="brackets">R638</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id2">2</a>)</span></dt>
<dd><p>Varshalovich, D A, Quantum Theory of Angular Momentum. 1988.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.Rotation.D">
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">D</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">beta</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gamma</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L512-L553"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.Rotation.D" title="Permalink to this definition">¶</a></dt>
<dd><p>Wigner D-function.</p>
<p>Returns an instance of the WignerD class corresponding to the Wigner-D
function specified by the parameters.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>j</strong> : Number</p>
<blockquote>
<div><p>Total angular momentum</p>
</div></blockquote>
<p><strong>m</strong> : Number</p>
<blockquote>
<div><p>Eigenvalue of angular momentum along axis after rotation</p>
</div></blockquote>
<p><strong>mp</strong> : Number</p>
<blockquote>
<div><p>Eigenvalue of angular momentum along rotated axis</p>
</div></blockquote>
<p><strong>alpha</strong> : Number, Symbol</p>
<blockquote>
<div><p>First Euler angle of rotation</p>
</div></blockquote>
<p><strong>beta</strong> : Number, Symbol</p>
<blockquote>
<div><p>Second Euler angle of rotation</p>
</div></blockquote>
<p><strong>gamma</strong> : Number, Symbol</p>
<blockquote>
<div><p>Third Euler angle of rotation</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>Return the Wigner-D matrix element for a defined rotation, both
numerical and symbolic:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">Rotation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span><span class="p">,</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">alpha</span><span class="p">,</span> <span class="n">beta</span><span class="p">,</span> <span class="n">gamma</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;alpha beta gamma&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Rotation</span><span class="o">.</span><span class="n">D</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span><span class="n">pi</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="o">-</span><span class="n">pi</span><span class="p">)</span>
<span class="go">WignerD(1, 1, 0, pi, pi/2, -pi)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.WignerD" title="sympy.physics.quantum.spin.WignerD"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WignerD</span></code></a></dt><dd><p>Symbolic Wigner-D function</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.Rotation.d">
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">d</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">beta</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L555-L593"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.Rotation.d" title="Permalink to this definition">¶</a></dt>
<dd><p>Wigner small-d function.</p>
<p>Returns an instance of the WignerD class corresponding to the Wigner-D
function specified by the parameters with the alpha and gamma angles
given as 0.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>j</strong> : Number</p>
<blockquote>
<div><p>Total angular momentum</p>
</div></blockquote>
<p><strong>m</strong> : Number</p>
<blockquote>
<div><p>Eigenvalue of angular momentum along axis after rotation</p>
</div></blockquote>
<p><strong>mp</strong> : Number</p>
<blockquote>
<div><p>Eigenvalue of angular momentum along rotated axis</p>
</div></blockquote>
<p><strong>beta</strong> : Number, Symbol</p>
<blockquote>
<div><p>Second Euler angle of rotation</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>Return the Wigner-D matrix element for a defined rotation, both
numerical and symbolic:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">Rotation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span><span class="p">,</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">beta</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;beta&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Rotation</span><span class="o">.</span><span class="n">d</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
<span class="go">WignerD(1, 1, 0, 0, pi/2, 0)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.WignerD" title="sympy.physics.quantum.spin.WignerD"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WignerD</span></code></a></dt><dd><p>Symbolic Wigner-D function</p>
</dd>
</dl>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.WignerD">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">WignerD</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">hints</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L688-L893"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.WignerD" title="Permalink to this definition">¶</a></dt>
<dd><p>Wigner-D function</p>
<p>The Wigner D-function gives the matrix elements of the rotation
operator in the jm-representation. For the Euler angles <span class="math notranslate nohighlight">\(\alpha\)</span>,
<span class="math notranslate nohighlight">\(\beta\)</span>, <span class="math notranslate nohighlight">\(\gamma\)</span>, the D-function is defined such that:</p>
<div class="math notranslate nohighlight">
\[&lt;j,m| \mathcal{R}(\alpha, \beta, \gamma ) |j',m'&gt; = \delta_{jj'} D(j, m, m', \alpha, \beta, \gamma)\]</div>
<p>Where the rotation operator is as defined by the Rotation class <a class="reference internal" href="#r639" id="id3"><span>[R639]</span></a>.</p>
<p>The Wigner D-function defined in this way gives:</p>
<div class="math notranslate nohighlight">
\[D(j, m, m', \alpha, \beta, \gamma) = e^{-i m \alpha} d(j, m, m', \beta) e^{-i m' \gamma}\]</div>
<p>Where d is the Wigner small-d function, which is given by Rotation.d.</p>
<p>The Wigner small-d function gives the component of the Wigner
D-function that is determined by the second Euler angle. That is the
Wigner D-function is:</p>
<div class="math notranslate nohighlight">
\[D(j, m, m', \alpha, \beta, \gamma) = e^{-i m \alpha} d(j, m, m', \beta) e^{-i m' \gamma}\]</div>
<p>Where d is the small-d function. The Wigner D-function is given by
Rotation.D.</p>
<p>Note that to evaluate the D-function, the j, m and mp parameters must
be integer or half integer numbers.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>j</strong> : Number</p>
<blockquote>
<div><p>Total angular momentum</p>
</div></blockquote>
<p><strong>m</strong> : Number</p>
<blockquote>
<div><p>Eigenvalue of angular momentum along axis after rotation</p>
</div></blockquote>
<p><strong>mp</strong> : Number</p>
<blockquote>
<div><p>Eigenvalue of angular momentum along rotated axis</p>
</div></blockquote>
<p><strong>alpha</strong> : Number, Symbol</p>
<blockquote>
<div><p>First Euler angle of rotation</p>
</div></blockquote>
<p><strong>beta</strong> : Number, Symbol</p>
<blockquote>
<div><p>Second Euler angle of rotation</p>
</div></blockquote>
<p><strong>gamma</strong> : Number, Symbol</p>
<blockquote>
<div><p>Third Euler angle of rotation</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>Evaluate the Wigner-D matrix elements of a simple rotation:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">Rotation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rot</span> <span class="o">=</span> <span class="n">Rotation</span><span class="o">.</span><span class="n">D</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">pi</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rot</span>
<span class="go">WignerD(1, 1, 0, pi, pi/2, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rot</span><span class="o">.</span><span class="n">doit</span><span class="p">()</span>
<span class="go">sqrt(2)/2</span>
</pre></div>
</div>
<p>Evaluate the Wigner-d matrix elements of a simple rotation</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">rot</span> <span class="o">=</span> <span class="n">Rotation</span><span class="o">.</span><span class="n">d</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rot</span>
<span class="go">WignerD(1, 1, 0, 0, pi/2, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rot</span><span class="o">.</span><span class="n">doit</span><span class="p">()</span>
<span class="go">-sqrt(2)/2</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.physics.quantum.spin.Rotation" title="sympy.physics.quantum.spin.Rotation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Rotation</span></code></a></dt><dd><p>Rotation operator</p>
</dd>
</dl>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r639"><span class="brackets">R639</span><span class="fn-backref">(<a href="#id3">1</a>,<a href="#id4">2</a>)</span></dt>
<dd><p>Varshalovich, D A, Quantum Theory of Angular Momentum. 1988.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.couple">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">couple</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jcoupling_list</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1786-L1853"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.couple" title="Permalink to this definition">¶</a></dt>
<dd><p>Couple a tensor product of spin states</p>
<p>This function can be used to couple an uncoupled tensor product of spin
states. All of the eigenstates to be coupled must be of the same class. It
will return a linear combination of eigenstates that are subclasses of
CoupledSpinState determined by Clebsch-Gordan angular momentum coupling
coefficients.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>expr</strong> : Expr</p>
<blockquote>
<div><p>An expression involving TensorProducts of spin states to be coupled.
Each state must be a subclass of SpinState and they all must be the
same class.</p>
</div></blockquote>
<p><strong>jcoupling_list</strong> : list or tuple</p>
<blockquote>
<div><p>Elements of this list are sub-lists of length 2 specifying the order of
the coupling of the spin spaces. The length of this must be N-1, where N
is the number of states in the tensor product to be coupled. The
elements of this sublist are the same as the first two elements of each
sublist in the <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> parameter defined for JzKetCoupled. If this
parameter is not specified, the default value is taken, which couples
the first and second product basis spaces, then couples this new coupled
space to the third product space, etc</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>Couple a tensor product of numerical states for two spaces:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">JzKet</span><span class="p">,</span> <span class="n">couple</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.tensorproduct</span> <span class="kn">import</span> <span class="n">TensorProduct</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">couple</span><span class="p">(</span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)))</span>
<span class="go">-sqrt(2)*|1,1,j1=1,j2=1&gt;/2 + sqrt(2)*|2,1,j1=1,j2=1&gt;/2</span>
</pre></div>
</div>
<p>Numerical coupling of three spaces using the default coupling method, i.e.
first and second spaces couple, then this couples to the third space:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">couple</span><span class="p">(</span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">)))</span>
<span class="go">sqrt(6)*|2,2,j1=1,j2=1,j3=1,j(1,2)=2&gt;/3 + sqrt(3)*|3,2,j1=1,j2=1,j3=1,j(1,2)=2&gt;/3</span>
</pre></div>
</div>
<p>Perform this same coupling, but we define the coupling to first couple
the first and third spaces:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">couple</span><span class="p">(</span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">)),</span> <span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="p">)</span>
<span class="go">sqrt(2)*|2,2,j1=1,j2=1,j3=1,j(1,3)=1&gt;/2 - sqrt(6)*|2,2,j1=1,j2=1,j3=1,j(1,3)=2&gt;/6 + sqrt(3)*|3,2,j1=1,j2=1,j3=1,j(1,3)=2&gt;/3</span>
</pre></div>
</div>
<p>Couple a tensor product of symbolic states:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j1</span><span class="p">,</span><span class="n">m1</span><span class="p">,</span><span class="n">j2</span><span class="p">,</span><span class="n">m2</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;j1 m1 j2 m2&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">couple</span><span class="p">(</span><span class="n">TensorProduct</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="n">j1</span><span class="p">,</span><span class="n">m1</span><span class="p">),</span> <span class="n">JzKet</span><span class="p">(</span><span class="n">j2</span><span class="p">,</span><span class="n">m2</span><span class="p">)))</span>
<span class="go">Sum(CG(j1, m1, j2, m2, j, m1 + m2)*|j,m1 + m2,j1=j1,j2=j2&gt;, (j, m1 + m2, j1 + j2))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.physics.quantum.spin.uncouple">
<span class="sig-prename descclassname"><span class="pre">sympy.physics.quantum.spin.</span></span><span class="sig-name descname"><span class="pre">uncouple</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jn</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">jcoupling_list</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/physics/quantum/spin.py#L1969-L2040"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.physics.quantum.spin.uncouple" title="Permalink to this definition">¶</a></dt>
<dd><p>Uncouple a coupled spin state</p>
<p>Gives the uncoupled representation of a coupled spin state. Arguments must
be either a spin state that is a subclass of CoupledSpinState or a spin
state that is a subclass of SpinState and an array giving the j values
of the spaces that are to be coupled</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>expr</strong> : Expr</p>
<blockquote>
<div><p>The expression containing states that are to be coupled. If the states
are a subclass of SpinState, the <code class="docutils literal notranslate"><span class="pre">jn</span></code> and <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> parameters
must be defined. If the states are a subclass of CoupledSpinState,
<code class="docutils literal notranslate"><span class="pre">jn</span></code> and <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> will be taken from the state.</p>
</div></blockquote>
<p><strong>jn</strong> : list or tuple</p>
<blockquote>
<div><p>The list of the j-values that are coupled. If state is a
CoupledSpinState, this parameter is ignored. This must be defined if
state is not a subclass of CoupledSpinState. The syntax of this
parameter is the same as the <code class="docutils literal notranslate"><span class="pre">jn</span></code> parameter of JzKetCoupled.</p>
</div></blockquote>
<p><strong>jcoupling_list</strong> : list or tuple</p>
<blockquote>
<div><p>The list defining how the j-values are coupled together. If state is a
CoupledSpinState, this parameter is ignored. This must be defined if
state is not a subclass of CoupledSpinState. The syntax of this
parameter is the same as the <code class="docutils literal notranslate"><span class="pre">jcoupling</span></code> parameter of JzKetCoupled.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>Uncouple a numerical state using a CoupledSpinState state:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">JzKetCoupled</span><span class="p">,</span> <span class="n">uncouple</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">S</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">uncouple</span><span class="p">(</span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">(</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">sqrt(2)*|1/2,-1/2&gt;x|1/2,1/2&gt;/2 + sqrt(2)*|1/2,1/2&gt;x|1/2,-1/2&gt;/2</span>
</pre></div>
</div>
<p>Perform the same calculation using a SpinState state:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.physics.quantum.spin</span> <span class="kn">import</span> <span class="n">JzKet</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">uncouple</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">))</span>
<span class="go">sqrt(2)*|1/2,-1/2&gt;x|1/2,1/2&gt;/2 + sqrt(2)*|1/2,1/2&gt;x|1/2,-1/2&gt;/2</span>
</pre></div>
</div>
<p>Uncouple a numerical state of three coupled spaces using a CoupledSpinState state:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">uncouple</span><span class="p">(</span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span> <span class="p">))</span>
<span class="go">|1,-1&gt;x|1,1&gt;x|1,1&gt;/2 - |1,0&gt;x|1,0&gt;x|1,1&gt;/2 + |1,1&gt;x|1,0&gt;x|1,0&gt;/2 - |1,1&gt;x|1,1&gt;x|1,-1&gt;/2</span>
</pre></div>
</div>
<p>Perform the same calculation using a SpinState state:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">uncouple</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span> <span class="p">)</span>
<span class="go">|1,-1&gt;x|1,1&gt;x|1,1&gt;/2 - |1,0&gt;x|1,0&gt;x|1,1&gt;/2 + |1,1&gt;x|1,0&gt;x|1,0&gt;/2 - |1,1&gt;x|1,1&gt;x|1,-1&gt;/2</span>
</pre></div>
</div>
<p>Uncouple a symbolic state using a CoupledSpinState state:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j</span><span class="p">,</span><span class="n">m</span><span class="p">,</span><span class="n">j1</span><span class="p">,</span><span class="n">j2</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;j m j1 j2&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">uncouple</span><span class="p">(</span><span class="n">JzKetCoupled</span><span class="p">(</span><span class="n">j</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="p">(</span><span class="n">j1</span><span class="p">,</span> <span class="n">j2</span><span class="p">)))</span>
<span class="go">Sum(CG(j1, m1, j2, m2, j, m)*|j1,m1&gt;x|j2,m2&gt;, (m1, -j1, j1), (m2, -j2, j2))</span>
</pre></div>
</div>
<p>Perform the same calculation using a SpinState state</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">uncouple</span><span class="p">(</span><span class="n">JzKet</span><span class="p">(</span><span class="n">j</span><span class="p">,</span> <span class="n">m</span><span class="p">),</span> <span class="p">(</span><span class="n">j1</span><span class="p">,</span> <span class="n">j2</span><span class="p">))</span>
<span class="go">Sum(CG(j1, m1, j2, m2, j, m)*|j1,m1&gt;x|j2,m2&gt;, (m1, -j1, j1), (m2, -j2, j2))</span>
</pre></div>
</div>
</dd></dl>

</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../../index.html">
              <img class="logo" src="../../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="represent.html"
                        title="previous chapter">Represent</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="state.html"
                        title="next chapter">State</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../../_sources/modules/physics/quantum/spin.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="state.html" title="State"
             >next</a> |</li>
        <li class="right" >
          <a href="represent.html" title="Represent"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../index.html" >Physics</a> &#187;</li>
          <li class="nav-item nav-item-3"><a href="index.html" >Quantum Mechanics</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Spin</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/physics/quantum/spin.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:27:47 GMT -->
</html>